<style type="text/css">
	legend {
		font-size:8px;
		font-weight:bold;
		text-transform:uppercase;
		background:#f1f1f1;
		border-top:1px dotted #333;
		border-left:1px dotted #333;
		border-right:1px dotted #333;
		padding:3px;
		background:#ddd;
	}
	fieldset {
		background:#f4f4f4;
		border:1px dotted #333;
                margin-top: 10px;
	}
	.noborder {
		border:none;
		background:none;
	}
	input[type=button] {
		font-size:11px;
	}
</style>
<script type="text/javascript">
    $(document).ready(function(){
        $("img[rel]").overlay();        
    })  
</script>
<script type="text/javascript">
    $(document).ready(function(){
        $('.add-form').hide();
        $('.add').click(function(){
            $('.add-form').slideToggle('fast');
        })
        
        $("input[type=submit]").click(function(){
            if($('#alamat').val() == ""){
                alert('Alamat tidak boleh kosong');
                $('#alamat').focus();
                return false;
            }
            if($('#noTelp').val() == ""){
               alert('No. Telepon tidak boleh kosong');
               $('#noTelp').focus();
               return false;
            }
            if($('#pekerjaan').val() == ""){
               alert('Pekerjaan harus dipilih');
               $('#pekerjaan').focus();
               return false;
            }
        })
    })
</script>
<div class="judul"><?php echo anchor($linkBack, $title);?> <span class="breadcrumb"><?php echo "$titlePage";?></span></div>
<?php
  $flashdata = $this->session->flashdata('message');
  $messages = isset ($flashdata)?pesan($flashdata):"";
  echo "$messages";
?>
<fieldset>
    <legend><?php echo "$titlePage";?></legend>
    <?php
      foreach ($listMember as $row);
    ?>
    <div style="width: 500px;float: left">
    <table width="100%" cellpadding="3px">
        <tr>
            <td width="150px">- Nama</td><td><?php echo $row['member']['member'];?></td>
        </tr>   
        <tr>
            <td>- Tgl. Lahir</td><td><?php echo datefmysql($row['member']['tgl_lahir']);?></td>
        </tr>
        <tr>
            <td>- Jenis Kelamin</td><td><?php echo $row['member']['jenis_kelamin'];?></td>
        </tr>
        <tr>
            <td>- Alamat</td><td><?php echo $row['member']['alamat'];?></td>
        </tr>
        <tr>
            <td>- No. Telepon</td><td><?php echo $row['member']['no_telp'];?></td>
        </tr>
        <tr>
            <td>- Pekerjaan</td><td><?php echo $row['member']['pekerjaan'];?></td>
        </tr>
        <tr>
            <td valign="top">- Jenis Keanggotaan</td>
            <td>
                <?php
                    foreach ($row['jenis_keanggotaan'] as $rows){
                ?>
                    - <?php echo $rows['jenis_member'];?><br />
                <?php    
                    }
                ?>
            </td>
        </tr>
    </table>
    </div>
    <div style="width: 300px;float: left">
        Foto Member 
        <br /><br />
        <?php
            if($row['member']['gambar'] == ''){
        ?>
          <img src="<?php echo base_url()."system/image/user_icon.png"?>" />
        <?php
            }else{
        ?>  
        <div id="photos">
          <img src="<?php echo base_url()."system/image/foto_member/thumbs/".$row['member']['gambar']?>" rel="#mies1" title="klik untuk zoom"/>
        </div>
        <div class="simple_overlay" id="mies1"><div class="close"></div>
	   <img src="<?php echo base_url()."system/image/foto_member/".$row['member']['gambar']?>" />
        </div>
        <?php
           }
        ?>
    </div>
    <div style="clear:both;padding-top: 10px;">
       <?php
        foreach ($user['keanggotaan'] as $keanggotaans);
        if(in_array('Head', $keanggotaans) || in_array('Super Admin', $keanggotaans)){
            foreach ($cekDonaturTunggal as $donatur);
            foreach ($cekKakakPembina as $pembina);
            if($donatur['jumlah'] > 0){
           ?>
            <a href="<?php echo site_url("member/relasi_donatur_tunggal/".$row['member']['id']."");?>" class="people">Relasi Donatur Tunggal</a>
           <?php 
            }
            if($pembina['jumlah'] > 0){
           ?>
            <a href="<?php echo site_url("member/relasi_kakak_pembina/".$row['member']['id']."");?>" class="people">Relasi Kakak Pembina</a>
           <?php 
            }
        }
       ?> 
    </div>  
</fieldset>
<p>Rekap Data Dinamis Member</p>
<div class="data-input">
    <fieldset class="add-form">
        <legend>Form Tambah Data Dinamis Member</legend>
        <?php  
          echo form_open_multipart($subLink,'');
        ?>
          <label>Alamat</label><?php echo form_input("alamat","","id='alamat'");?>
          <label>No. Telepon</label><?php echo form_input("noTelp","","id='noTelp'");?>
          <label>Pekerjaan</label>
          <select name="pekerjaan" id="pekerjaan">
                <option value="">Pilih pekerjaan</option>
                <?php
                     foreach ($listPekerjaan as $pkj){
                ?>        
                    <option value="<?php echo $pkj['id'];?>"><?php echo $pkj['nama'];?></option>
                <?php     
                     }
                ?>
          </select>
          <fieldset class="field-group">
              <label>Foto</label><?php echo form_upload('userfile');?>
           </fieldset>
          <fieldset class="input-process">
              <?php
                  echo form_hidden('idMember', $row['member']['id']);
                  echo form_submit("edit", "Simpan", "class='button' style='margin-right:2px'");
                  echo form_button('Batal', 'Batal', 'class=button onClick='."javascript:location.href='".base_url()."index.php/member/detail_member/".$row['member']['id']."'");
              ?>
          </fieldset>
        <?php
          echo form_close();
        ?>
    </fieldset>
</div>
<div class="data-list">
    <div class="floleft" style="margin: 8px 0">
       <?php
         if(in_array('Head', $keanggotaans) || in_array('Super Admin', $keanggotaans)){
             echo addButton('#', 'tambah');
         }
       ?>
    </div>
    <table class="tabel">
        <tr>
            <th>No</th>
            <th>Tanggal</th>
            <th>Alamat</th>
            <th>No. Telepon</th>
            <th>Pekerjaan</th>
            <th>Status</th>
        </tr>
        <?php
           $no = 1;
           foreach ($dinamisMember as $rows){
        ?>
        <tr class="<?php echo ($no%2)?"even":"odd";?>">
            <td align="center" style="width: 5%"><?php echo $no++;?></td>
            <td style="width: 10%;text-align: center"><?php echo datefmysql($rows['tanggal']);?></td>
            <td><?php echo $rows['alamat'];?></td>
            <td style="width: 15%"><?php echo $rows['no_telp'];?></td>
            <td style="width: 15%"><?php echo $rows['pekerjaan'];?></td>
            <td style="width: 15%">
              <?php
                 if($rows['status'] == '1'){
                     echo "Aktif";
                 }else echo "Non-aktif";
              ?>
            </td>
        </tr>
        <?php
           }
        ?>
    </table> 
</div>
